package com.ye.feign;

import com.ye.domain.Music;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("mould-db")
public interface MusicFeign {

    //    通过歌名搜索
    @GetMapping("/getMusicListByName")
    public List<Music> getMusicListByName(@RequestParam("songName") String songName);

    //    通过歌名模糊搜索
    @GetMapping("/fuzzySearchMusic")
    public List<Music> fuzzySearch(@RequestParam("songName") String songName);

    @PostMapping("/saveMusic")
    public void saveMusicData(@RequestBody Music music);

    //    利用Mybatis的foreach来进行歌曲的插入
    @PostMapping("/batchSave")
    public void batchSave(@RequestBody List<Music> musicList);

    //    获取曲库歌曲数量
    @GetMapping("/countMusic")
    public Integer countMusicNum();

    //    随机12首歌曲
    @GetMapping("/randMusic")
    public List<Music> rand12();
}
